package com.lxy.labsystem.controller;


import com.lxy.labsystem.pojo.Lab;
import com.lxy.labsystem.service.LabService;
import com.lxy.labsystem.utils.ResultOBJ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/adminapi/labs")
@RestController
public class LabController {

    @Autowired
    private LabService labService;

    @GetMapping
    public List<Lab>getLabList(Lab lab){
        return labService.getLabList(lab);
    }

    @PostMapping
    public ResultOBJ addLabList(@RequestBody Lab lab){
        try{
            labService.addLabList(lab);
            return ResultOBJ.ADD_SUCCESS;
        } catch (Exception e){
            return ResultOBJ.ADD_ERROR;
        }
    }

}

